<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        ul{
            list-style: none;
        }
        footer{
            width: 100%;
            height: 40px;
            border-top: 1px solid #cccccc;
            position:fixed;
            left: 0;
            bottom: 0;
        }
        ul{
            display: flex;
            justify-content: space-around;
        }
        ul>li{
            flex: 1;
            line-height: 40px;
            text-align: center;
        }
        .active{
            background: #cccccc;
            color: aliceblue;
        }
    </style>
</head>
<body>
    <div id="box">
        <template>
            <div class="page">
                <home v-if="current==0"></home>
                <goods v-if="current==1"></goods>
                <detail v-if="current==2"></detail>
            </div>
            <footer class="tabBar">
                <ul>
                    <li @click="current=0" :class="current==0 ? 'active' : ''">首页</li>
                    <li @click="current=1" :class="current==1 ? 'active' : ''">商品</li>
                    <li @click="current=2" :class="current==2 ? 'active' : ''">详情</li>
                </ul>
            </footer>
        </template>
    </div>
    <script>
        Vue.component("home",{
            template:`
                <div>
                    <h1>首页</h1>
                </div>
            `
        })
        Vue.component("detail",{
            template:`
                <div>
                    <h1>详情</h1>
                </div>
            `
        })
        Vue.component("goods",{
            template:`
                <div>
                    <h1>商品</h1>
                </div>
            `
        })
        const vm = new Vue({
            el:"#box",
            data:{
                current:0
            },
            methods:{
            },
        })
    </script>
</body>
</html>